<?php
/*
 * This is growth page for child
 */
include '../../include/config.php';
$q = mysql_query("select * from baby_012_growth where bid = '" . $_COOKIE['bid'] . "'");
$rp = $_SERVER['REQUEST_URI'];
if (mysql_num_rows($q) == 0) {
    echo 'not inserted any data...:P';
    ?>
    <form method="post" action="../child/child_012.php" >
        <input type="hidden" name="action" value="insert_012" />
        <input type="hidden" name="rp" value="<?php echo $rp; ?>" />
        <input type="submit" value="Start Entry" />
    </form>
<?php } else {
    ?>
    <script>
                
        function wl(val, type){
            var type= document.getElementById(type).value;
            if(type=='kg')
            {
                var value = document.getElementById(val).value /2.2046;
                document.getElementById(val).value = value;
            }
            if(type=='lbs'){
                var value = document.getElementById(val).value * 2.2046;
                document.getElementById(val).value = value;
            }
        }
                
        //    function w2l(we,lb){
        //        var w = we;
        //        var l = lb;
        //        var weight = document.getElementById(w).value;
        //        var newight = weight * 2.2046;
        //        alert('Weight = '+weight+'\n Lbs = '+newight);
        //        document.getElementById(l).value = newight;
        //    }
        //    function l2w(we,lb){
        //        var w = we;
        //        var l = lb;
        //        var lbs = document.getElementById(l).value;
        //        var newlbs = lbs / 2.2046;
        //        alert('Lbs = '+lbs+'\nWeight = '+newlbs);
        //        document.getElementById(w).value = newlbs;
        //    }
        function fc(val,type){
            var type= document.getElementById(type).value;
            if(type=='cm'){
                var value = document.getElementById(val).value / 0.03;           
                document.getElementById(val).value= value;
                //  alert('cm selected. \nCM ='+value);
            }
            if(type=='ft')
            {
                var value = document.getElementById(val).value * 0.03;           
                document.getElementById(val).value= value;
                //    alert('evaluating foot');
            }        
        }  


    </script>
    <?php while ($row = mysql_fetch_array($q)) { ?>
        <form action="../child/child_012.php" method="post" >  
            <table style="width: 600px; border-collapse: collapse; " border="1" >
                <tr>
                    <th style="width: 100px; " >AGE</th>
                    <th style="width: 125px;">WEIGHT</th>
                    <th style="width: 125px;">LENGTH</th>
                    <th style="width: 100px;">CRANICAL MEASUREMENT</th>
                    <th style="width: 150px;">KIND OF FEEDING</th>
                </tr>
                <tr style="height: 100px;">
                    <th>1 MONTH</th>
                    <td>
                <center>
                    <input type="text" size="5" name="1" id="1m0v" value="<?= $row[1] ?>" />            
                    <select name="2" style="width: 2;" id="1m0t" onchange="wl('1m0v','1m0t')" >
                        <option value="kg" <?php if ($row[2] == 'kg') { ?> selected="selected"  <?php } ?> >Kg</option>
                        <option value="lbs"<?php if ($row[2] == 'lbs') { ?> selected="selected"  <?php } ?> >Lbs</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="3" id="1m1v" value="<?= $row[3] ?>" />
                    <select name="4" id="1m1t" onchange="fc('1m1v','1m1t')" >
                        <option value="cm" <?php if ($row[4] == 'cm') { ?> selected="selected"  <?php } ?> >cm</option>
                        <option value="ft" <?php if ($row[4] == 'ft') { ?> selected="selected"  <?php } ?> >ft</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="5" id="1m2v" value="<?= $row[5] ?>" /><br/>
                    <select name="6" id="1m2t" onchange="fc('1m2v','1m2t')" >
                        <option value="cm" <?php if ($row[6] == 'cm') { ?> selected="selected"  <?php } ?> >cm</option>
                        <option value="ft" <?php if ($row[6] == 'ft') { ?> selected="selected"  <?php } ?> >ft</option>
                    </select>
                </center>
                </td>
                <td>
                    <textarea name="7" cols="20" rows="5"><?= $row[7] ?></textarea>
                </td>
                </tr>
                <tr style="height: 100px;">
                    <th>2 MONTH</th>
                    <td>
                <center>
                    <input type="text" size="5" name="8" id="2m0v" value="<?= $row[8] ?>" />
                    <select name="9" style="width: 2;" id="2m0t" onchange="wl('2m0v','2m0t')" >
                        <option value="kg" <?php if ($row[9] == 'kg') { ?> selected="selected"  <?php } ?> >Kg</option>
                        <option value="lbs" <?php if ($row[9] == 'lbs') { ?> selected="selected"  <?php } ?> >Lbs</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="10" id="2m1v" value="<?= $row[10] ?>" />
                    <select name="11" id="2m1t" onchange="fc('2m1v','2m1t')" >
                        <option value="cm" <?php if ($row[11] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[11] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="12" id="2m2v" value="<?= $row[12] ?>" /><br/>
                    <select name="13" id="2m2t" onchange="fc('2m2v','2m2t')" >
                        <option value="cm" <?php if ($row[13] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[13] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                    <textarea name="14" cols="20" rows="5" ><?= $row[14] ?></textarea>
                </td>
                </tr>
                <tr style="height: 100px;">
                    <th>3 MONTH</th>
                    <td>
                <center>
                    <input type="text" size="5" name="15" id="3m0v" value="<?= $row[15] ?>" />
                    <select name="16" style="width: 2;" id="3m0t" onchange="wl('3m0v','3m0t')" >
                        <option value="kg" <?php if ($row[16] == 'kg') { ?> selected="selected"  <?php } ?> >Kg</option>
                        <option value="lbs" <?php if ($row[16] == 'lbs') { ?> selected="selected"  <?php } ?> >Lbs</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="17" id="3m1v" value="<?= $row[17] ?>" />
                    <select name="18" id="3m1t" onchange="fc('3m1v','3m1t')" >
                        <option value="cm" <?php if ($row[18] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[18] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="19" id="3m2v" value="<?= $row[19] ?>" /><br/>
                    <select name="20" id="3m2t" onchange="fc('3m2v','3m2t')" >
                        <option value="cm" <?php if ($row[20] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[20] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                    <textarea name="21" cols="20" rows="5" ><?= $row[21] ?></textarea>
                </td>
                </tr>
                <tr style="height: 100px;">
                    <th>4 MONTH</th>
                    <td>
                <center>
                    <input type="text" size="5" name="22" id="4m0v" value="<?= $row[22] ?>" />
                    <select name="23" style="width: 2;" id="4m0t" onchange="wl('4m0v','4m0t')" >
                        <option value="kg" <?php if ($row[23] == 'kg') { ?> selected="selected"  <?php } ?> >Kg</option>
                        <option value="lbs" <?php if ($row[23] == 'lbs') { ?> selected="selected"  <?php } ?> >Lbs</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="24" id="4m1v" value="<?= $row[24] ?>" />
                    <select name="25" id="4m1t" onchange="fc('4m1v','4m1t')" >
                        <option value="cm" <?php if ($row[25] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[25] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="26" id="4m2v" value="<?= $row[26] ?>" /><br/>
                    <select name="27" id="4m2t" onchange="fc('4m2v','4m2t')" >
                        <option value="cm" <?php if ($row[27] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[27] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                    <textarea name="28" cols="20" rows="5" ><?= $row[28] ?></textarea>
                </td>
                </tr>
                <tr style="height: 100px;">
                    <th>5 MONTH</th>
                    <td>
                <center>
                    <input type="text" size="5" name="29" id="5m0v" value="<?= $row[29] ?>" />
                    <select name="30" style="width: 2;" id="5m0t" onchange="wl('5m0v','5m0t')" >
                        <option value="kg" <?php if ($row[30] == 'kg') { ?> selected="selected"  <?php } ?>>Kg</option>
                        <option value="lbs" <?php if ($row[30] == 'lbs') { ?> selected="selected"  <?php } ?>>Lbs</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="31" id="5m1v" value="<?= $row[31] ?>" />
                    <select name="32" id="5m1t" onchange="fc('5m1v','5m1t')" >
                        <option value="cm" <?php if ($row[32] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[32] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="33" id="5m2v" value="<?= $row[33] ?>" /><br/>
                    <select name="34" id="5m2t" onchange="fc('5m2v','5m2t')" >
                        <option value="cm" <?php if ($row[34] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[34] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                    <textarea name="35" cols="20" rows="5" ><?= $row[35] ?></textarea>
                </td>
                </tr>
                <tr style="height: 100px;">
                    <th>6 MONTH</th>
                    <td>
                <center>
                    <input type="text" size="5" name="36" id="6m0v" value="<?= $row[36] ?>" />
                    <select name="37" style="width: 2;" id="6m0t" onchange="wl('6m0v','6m0t')" >
                        <option value="kg" <?php if ($row[37] == 'kg') { ?> selected="selected"  <?php } ?>>Kg</option>
                        <option value="lbs" <?php if ($row[37] == 'lbs') { ?> selected="selected"  <?php } ?>>Lbs</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="38" id="6m1v" value="<?= $row[38] ?>" />
                    <select name="39" id="6m1t" onchange="fc('6m1v','6m1t')" >
                        <option value="cm" <?php if ($row[39] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[39] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="40" id="6m2v" value="<?= $row[40] ?>"/><br/>
                    <select name="41" id="6m2t" onchange="fc('6m2v','6m2t')" >
                        <option value="cm" <?php if ($row[41] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[41] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                    <textarea name="42" cols="20" rows="5" ><?= $row[42] ?></textarea>
                </td>
                </tr>
                <tr style="height: 100px;">
                    <th>7 MONTH</th>
                    <td>
                <center>
                    <input type="text" size="5" name="43" id="7m0v" value="<?= $row[43] ?>" />
                    <select name="44" style="width: 2;" id="7m0t" onchange="wl('7m0v','7m0t')" >
                        <option value="kg" <?php if ($row[44] == 'kg') { ?> selected="selected"  <?php } ?>>Kg</option>
                        <option value="lbs" <?php if ($row[44] == 'kg') { ?> selected="selected"  <?php } ?>>Lbs</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="45" id="7m1v" value="<?= $row[45] ?>" />
                    <select name="46" id="7m1t" onchange="fc('7m1v','7m1t')" >
                        <option value="cm" <?php if ($row[46] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[46] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="47" id="7m2v" value="<?= $row[47] ?>" /><br/>
                    <select name="48" id="7m2t" onchange="fc('7m2v','7m2t')" >
                        <option value="cm" <?php if ($row[48] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[48] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                    <textarea name="49" cols="20" rows="5" ><?= $row[49] ?></textarea>
                </td>
                </tr>
                <tr style="height: 100px;">
                    <th>8 MONTH</th>
                    <td>
                <center>
                    <input type="text" size="5" name="50" id="8m0v" value="<?= $row[50] ?>" />
                    <select name="51" style="width: 2;" id="8m0t" onchange="wl('8m0v','8m0t')" >
                        <option value="kg" <?php if ($row[51] == 'kg') { ?> selected="selected"  <?php } ?>>Kg</option>
                        <option value="lbs" <?php if ($row[51] == 'lbs') { ?> selected="selected"  <?php } ?>>Lbs</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="52" id="8m1v" value="<?= $row[52] ?>" />
                    <select name="53" id="8m1t" onchange="fc('8m1v','8m1t')" >
                        <option value="cm" <?php if ($row[53] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[53] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="54" id="8m2v" value="<?= $row[54] ?>" /><br/>
                    <select name="55" id="8m2t" onchange="fc('8m2v','8m2t')" >
                        <option value="cm" <?php if ($row[55] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[55] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                    <textarea name="56" cols="20" rows="5" ><?= $row[56] ?></textarea>
                </td>
                </tr>
                <tr style="height: 100px;">
                    <th>9 MONTH</th>
                    <td>
                <center>
                    <input type="text" size="5" name="57" id="9m0v" value="<?= $row[57] ?>" />
                    <select name="58" style="width: 2;" id="9m0t" onchange="wl('9m0v','9m0t')" >
                        <option value="kg" <?php if ($row[58] == 'kg') { ?> selected="selected"  <?php } ?>>Kg</option>
                        <option value="lbs" <?php if ($row[58] == 'lbs') { ?> selected="selected"  <?php } ?>>Lbs</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="59" id="9m1v" value="<?= $row[59] ?>" />
                    <select name="60" id="9m1t" onchange="fc('9m1v','9m1t')" >
                        <option value="cm" <?php if ($row[60] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft"<?php if ($row[60] == 'ft') { ?> selected="selected"  <?php } ?> >ft</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="61" id="9m2v" value="<?= $row[61] ?>" /><br/>
                    <select name="62" id="9m2t" onchange="fc('9m2v','9m2t')" >
                        <option value="cm" <?php if ($row[62] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[62] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                    <textarea name="63" cols="20" rows="5" ><?= $row[63] ?></textarea>
                </td>
                </tr>
                <tr style="height: 100px;">
                    <th>10 MONTH</th>
                    <td>
                <center>
                    <input type="text" size="5" name="64" id="10m0v" value="<?= $row[64] ?>" />
                    <select name="65" style="width: 2;" id="10m0t" onchange="wl('10m0v','10m0t')" >
                        <option value="kg" <?php if ($row[65] == 'kg') { ?> selected="selected"  <?php } ?>>Kg</option>
                        <option value="lbs" <?php if ($row[65] == 'lbs') { ?> selected="selected"  <?php } ?>>Lbs</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="66" id="10m1v" value="<?= $row[66] ?>" />
                    <select name="67" id="10m1t" onchange="fc('10m1v','10m1t')" >
                        <option value="cm" <?php if ($row[67] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[67] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="68" id="10m2v" value="<?= $row[68] ?>" /><br/>
                    <select name="69" id="10m2t" onchange="fc('10m2v','10m2t')" >
                        <option value="cm" <?php if ($row[69] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[69] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                    <textarea name="70" cols="20" rows="5" ><?= $row[70] ?></textarea>
                </td>
                </tr>
                <tr style="height: 100px;">
                    <th>11 MONTH</th>
                    <td>
                <center>
                    <input type="text" size="5" name="71" id="11m0v" value="<?= $row[71] ?>" />
                    <select name="72" style="width: 2;" id="11m0t" onchange="wl('11m0v','11m0t')" >
                        <option value="kg" <?php if ($row[72] == 'kg') { ?> selected="selected"  <?php } ?>>Kg</option>
                        <option value="lbs" <?php if ($row[72] == 'lbs') { ?> selected="selected"  <?php } ?>>Lbs</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="73" id="11m1v" value="<?= $row[73] ?>" />
                    <select name="74" id="11m1t" onchange="fc('11m1v','11m1t')" >
                        <option value="cm" <?php if ($row[74] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[74] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="75" id="11m2v" value="<?= $row[75] ?>" /><br/>
                    <select name="76" id="11m2t" onchange="fc('11m2v','11m2t')" >
                        <option value="cm" <?php if ($row[76] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[76] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                    <textarea name="77" cols="20" rows="5" ><?= $row[77] ?></textarea>
                </td>
                </tr>
                <tr style="height: 100px;">
                    <th>12 MONTH</th>
                    <td>
                <center>
                    <input type="text" size="5" name="78" id="12m0v" value="<?= $row[78] ?>" />
                    <select name="79" style="width: 2;" id="12m0t" onchange="wl('12m0v','12m0t')" >
                        <option value="kg" <?php if ($row[79] == 'kg') { ?> selected="selected"  <?php } ?>>Kg</option>
                        <option value="lbs" <?php if ($row[79] == 'lbs') { ?> selected="selected"  <?php } ?>>Lbs</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="80" id="12m1v" value="<?= $row[80] ?>"  />
                    <select name="81" id="12m1t" onchange="fc('12m1v','12m1t')" >
                        <option value="cm" <?php if ($row[81] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[81] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                <center>
                    <input type="text" size="5" name="82" id="12m2v" value="<?= $row[82] ?>" /><br/>
                    <select  name="83" id="12m2t" onchange="fc('12m2v','12m2t')" >
                        <option value="cm" <?php if ($row[83] == 'cm') { ?> selected="selected"  <?php } ?>>cm</option>
                        <option value="ft" <?php if ($row[83] == 'ft') { ?> selected="selected"  <?php } ?>>ft</option>
                    </select>
                </center>
                </td>
                <td>
                    <textarea name="84" cols="20" rows="5" ><?= $row[84] ?></textarea>
                </td>
                </tr>

            </table>
            <input type="hidden" name="sr" value="<?php echo $row['sr']; ?>" />
            <input type="hidden" name="action"  value="update012" />
            <input type="hidden" name="rp" value="<?php echo $rp; ?>" />
            <input type="submit" style="width: 200px; height: 40px; color: green; float: left; " value="UPDATE" />

        </form>
    <?php
    }
}
?>